;(function($,md5){
	if(!$)throw 'required "jQuery.js" base this model ';
	if(!md5 || 'function' !== typeof md5)throw 'required "md5.js" to make value of sign!';
	var timestamp = $.now();;
	var secert = '8c89b98624bccfce4616a07242dae977';
	function sign(content){
		var preSign = null;
		if(content){
			if(content instanceof Object && !(content instanceof Array)){
				preSign = obj2str(null,content);
			}else if(content instanceof Array){
				preSign = arr2str(null,content);
			}
			preSign = preSign +'key='+secert+'&timestamp='+timestamp;
		}
		console.log('待签名串： \n'+preSign)
		return preSign ? md5(preSign) : '';
	}
	
	/**拼接对象(键的字母序排序) ==> str*/
	function obj2str(preKey,obj){
		var preSign = '',arrKeys = [];
		for(var key in obj){
			arrKeys.push(key);
		}
		arrKeys.sort();
		for(var i in arrKeys){
			var key = arrKeys[i],value = obj[key];
			key = (preKey ? preKey+'.' : '')+key;
			if(isVal(value)){
				preSign += key+'='+value+'&';
			}else if(value instanceof Object && !(value instanceof Array)){
				preSign += obj2str(key,value);
			}else if(value instanceof Array){
				preSign += arr2str(key,value);
			}
		}
		return preSign;
	}
	/**拼接数组 ==> str*/
	function arr2str(preKey,arr){
		var preSign = '';
		for(var i=0;i<arr.length;i++){
			var key = (preKey ? preKey:'')+'['+i+']';
			var value = arr[i];
			if(isVal(value)){
				preSign += key+'='+value+'&';
			}else if(value instanceof Object && !(value instanceof Array)){
				preSign += obj2str(key,value);
			}else if(value instanceof Array){
				preSign += arr2str(key,value);
			}
		}
		return preSign;
	}
	
	/**判断是否为值类型*/
	function isVal(obj){ 
		return ((typeof obj=='string') && obj.constructor==String) || 
			   ((typeof obj=='number') && obj.constructor==Number) || 
			   ((typeof obj=='boolean')&& obj.constructor==Boolean); 
	}
})(window.jQuery,window.md5);